import turtle as tl
import time
tl.setup(500,500,0,0)
tl.pensize(2)
tl.pencolor("red")
tl.penup()
tl.pendown()

a1 = (0,100)
a2 = (100,100)
a3 = (100,0)
a4 = (0,0)

tl.goto(0,0)
tl.setheading(tl.towards(a1))
tl.forward(100)
tl.penup()
tl.pendown()
time.sleep(1)

tl.goto(0,100)
tl.pensize(2)
tl.pencolor("red")
tl.setheading(tl.towards(a2))
tl.forward(100)
tl.penup()
tl.pendown()
time.sleep(1)

tl.pensize(2)
tl.pencolor("red")
tl.setheading(tl.towards(a3))
tl.forward(100)
tl.penup()
tl.pendown()
time.sleep(1)

tl.pensize(2)
tl.pencolor("red")
tl.setheading(tl.towards(a4))
tl.forward(100)
tl.penup()
tl.pendown()
time.sleep(1)

tl.done()  # 保持窗口打开